package pearson.automation.forms.courseDetails;

import org.openqa.selenium.By;

import framework.elements.Label;
/**
 * Details form for RO Collaborator
 *
 */
public class CourseDetailsNotEditableForm extends CourseDetailsForm {

    private static final String elementXpath =
        "//dl[@class='simpleDefinitionList']//dt[text()='%1$s']/../dd";
    private static final Label identifyer =
        new Label(By.className("simpleDefinitionList"),
            "Non editable course details");
    private final Label name;
    private final Label edition;
    private final Label privacy;

    @SuppressWarnings("static-access")
    public CourseDetailsNotEditableForm() {
        super(identifyer.getLocator(), identifyer.getName());
        name = new Label(By.xpath(
                String.format(elementXpath, "Course title:")), "Course title");
        edition = new Label(By.xpath(
                String.format(elementXpath, "Edition:")), "Edition");
        privacy = new Label(By.xpath(
                String.format(elementXpath, "Privacy:")), "Privacy setting");
        
        //Asserting, that there is no RW fields
        super.calendar.assertIsAbsent();
        super.courseNumber.assertIsAbsent();
        super.description.assertIsAbsent();
        super.edition.assertIsAbsent();
        super.privacy.assertIsAbsent();
        super.startDate.assertIsAbsent();
        super.subject.assertIsAbsent();
        super.tagsInput.assertIsAbsent();
        super.term.assertIsAbsent();
        super.save.assertIsAbsent();
    }

    @Override
    public final String getSubject() {
        return name.getText();
    }

    @Override
    public final String getEdition() {
        return edition.getText();
    }

    @Override
    public final String getPrivacy() {
        return privacy.getText();
    }

}
